import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Main from '../views/Main.vue'


Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/login'
},
{
  path: '/login',
  component: Login
},
{
  path: '/main',
  component: Main,
  children: [{
    path: '',
    redirect: 'overview'
  }, {
    path: 'overview',
    component: () => import('@/views/Overview.vue')
  }, {
    path: 'register/list',
    component: () => import('@/views/register/List.vue')
  }, {
    path: 'register/edit/:id',
    component: () => import('@/views/register/Edit.vue')
  }, {
    // 使用:变量名的方式定义动态路由
    path: 'register/detail/:id',
    component: () => import('@/views/register/Detail.vue')
  }, {
    path: 'register/add',
    component: () => import('@/views/register/Add.vue')
  }, {
    path: 'dictionary',
    component: () => import('@/views/Dictionary.vue')
  }]
}]

const router = new VueRouter({
  routes
})

export default router
